package com.itheima.info.manger.system.dao;

import com.itheima.info.manger.system.domain.Teacher;

public class TeacherDao {
    //创建容器
    private static Teacher[] teachers = new Teacher[10];

    //新增老师方法
    //参数  老师对象
    //返回值 布尔结果
    public boolean addTeacher(Teacher teacher){

        //找空位
        for (int i = 0; i < teachers.length; i++) {
            //每次循环遍历到的数据 teachers[i]
            Teacher tea = teachers[i];
            if(tea==null){
                //放数据
                teachers[i]=teacher;
                return true;
            }
        }
        //放不进去
        return false;
    }

    //查询所有
    //参数
    //返回值 所有的老师   老师数组
    public Teacher[] findAllTeachers(){
        return teachers;
    }
}
